package com.woniu.new_orange.service_model_gao.controller;

import com.woniu.new_orange.entity.CustomerServiceEvaluation;
import com.woniu.new_orange.entity.PassengerInformation;
import com.woniu.new_orange.service_model_gao.service.CustomerServiceEvaluationService;
import com.woniu.new_orange.service_model_gao.vo.CustomerServiceEvaluationVo;
import com.woniu.new_orange.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Program: new_orange->CustomerServiceEvaluationController
 * @Description: CustomerServiceEvaluation的controller
 * @Author: gao chaozhe
 * @Date: 2023-02-09 17:25
 * @Version： 1.0
 **/
@RestController
@RequestMapping("serviceEvaluation")
@Api(value = "用户给客服服务评价",tags="客服服务评价")
public class CustomerServiceEvaluationController {
    @Autowired
    private CustomerServiceEvaluationService customerServiceEvaluationService;

    @GetMapping("{id}")
    @ApiOperation(value = "获取客户服务评价表全部数据",notes = "获取评价表全部数据返回给前端页面展示")
    public Result queryAll(@PathVariable long id){
        List<CustomerServiceEvaluationVo> customerServiceEvaluationVos = customerServiceEvaluationService.selectAll(id);
        return Result.ok().data("customerServiceEvaluationList",customerServiceEvaluationVos);
    }

    @GetMapping("")
    @ApiOperation(value = "获取全部客服评价表",notes = "从数据库提取全部数据展示")
    public Result getAll(){
        List<CustomerServiceEvaluationVo> customerServiceEvaluationVos = customerServiceEvaluationService.selectAll2();
        return Result.ok().data("customerServiceEvaluationList1",customerServiceEvaluationVos);
    }

    @PostMapping("")
    @ApiOperation(value = "向客服服务评价表中添加数据",notes = "从前端页面获取数据后存入数据库中")
    public Result add(@RequestBody CustomerServiceEvaluation record){
        int i = customerServiceEvaluationService.insertSelective(record);
        return Result.ok();
    }
}
